<?php
//支付
class App_Payment extends Data_Base
{
    protected static $_config_items = array();
	//支付名
	//$paymentId int 支付编号
    public static function name ($paymentId)
    {
        if (empty(self::$_config_items))
        {
            $query = DB::select()
                ->from('tiyu_payment_config')
                ->execute();

            foreach ($query as $rs)
            {
                self::$_config_items[$rs['id']] = $rs;
            }
        }

        $item = Arr::get(self::$_config_items, $paymentId);
        return Arr::get($item, 'name');
    }
    
	//支付列表
    public static function infoList ()
    {
        $query = DB::select()
            ->from('tiyu_payment_config')
            ->order_by('sort', 'asc')
            ->execute();

        $result = $query->as_array();
        $ret    = array();
        foreach ($result as $rs)
        {
            if ($rs['name'] == '支付宝' && site::wechat())
            {
                //
            }
            else
            {
                $ret[] = $rs;
            }
        }

        return $ret;
    }
}
